/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PerformanceGUI.java
 *
 * Created on 02.01.2012, 19:18:44
 */
package performanceTester;

/**
 *
 * @author Chris
 */
public class PerformanceGUI extends javax.swing.JFrame {

    /** Creates new form PerformanceGUI */
    public PerformanceGUI() {
        initComponents();
        setTitle("Perfomance Tester");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        tfNanoTime = new javax.swing.JTextField();
        lbNanoTime = new javax.swing.JLabel();
        btCalcDurchsch = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.GridBagLayout());

        tfNanoTime.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 200;
        gridBagConstraints.insets = new java.awt.Insets(3, 14, 9, 0);
        getContentPane().add(tfNanoTime, gridBagConstraints);

        lbNanoTime.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbNanoTime.setText("Durchschnittszeit in Nano-Sekunden:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(10, 14, 3, 0);
        getContentPane().add(lbNanoTime, gridBagConstraints);

        btCalcDurchsch.setText("Calc Durchschnittszeit");
        btCalcDurchsch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onCalcDurschnitt(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.insets = new java.awt.Insets(0, 13, 0, 11);
        getContentPane().add(btCalcDurchsch, gridBagConstraints);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void onCalcDurschnitt(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onCalcDurschnitt
        long dsZeit = Performance.getDurschnittsZeit();
        tfNanoTime.setText("" + dsZeit);
    }//GEN-LAST:event_onCalcDurschnitt

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PerformanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PerformanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PerformanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PerformanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new PerformanceGUI().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCalcDurchsch;
    private javax.swing.JLabel lbNanoTime;
    private javax.swing.JTextField tfNanoTime;
    // End of variables declaration//GEN-END:variables
}
